//tslint:disable
import { Component, Input, OnInit, ViewChild, ElementRef } from '@angular/core';
import { PageModalService } from 'src/app/shared/service/page-modal-service';
declare let $: any;
@Component({
  selector: 'app-simple-tips-tag',
  templateUrl: './simple-tips-tag.component.html',
  styleUrls: ['./simple-tips-tag.component.scss'],
})
export class SimpleTipsTagComponent implements OnInit {
  @Input() tagData: any;
  simpleTipsTagId = 'simpleTipsTagId';

  constructor(private pageModalService: PageModalService) { }
  ngOnInit() {
    this.simpleTipsTagId += new Date().getTime();
    // const demoData = {
    //   type: "tag",
    //   style: "simpleTipsTag",
    //   name: "appSimpleIconTag",
    //   cssStyle: "padding: 0.25rem 0.5rem 0.25rem 0.5rem;height: 2.25rem;background: rgba(39, 196, 152, 0.05);border-radius: 1.25rem;margin-left: 0.5rem;margin-right: 0.5rem;",
    //   data: {
    //     icon: "assets/img/icon_explain@3x.png",
    //     close: "true",
    //     tips: "分享推广的的信息将显示您的号码"
    //   },
    //   linearLayout: "body"
    // };
  }
  closeTips(e) {
    e.stopPropagation();
    $('#' + this.simpleTipsTagId).fadeOut();
  }

  goPage(button,e) {
    e.stopPropagation();
    if (button && button.link) {
      this.pageModalService.openPage(button.link);
    } else if (button && button.partLink) {
      if (button.partLink.params.key.homeRecommendTabIndex) {
        if (document.getElementsByClassName('nav-toggle-bg1')) {
          const temp = document.getElementsByClassName('nav-toggle-bg1')[0].children[button.partLink.params.key.homeRecommendTabIndex] as HTMLElement;
          temp.click();
        }
      }
      // this.pageModalService.openPage(button.partLink);
    }
  }
}

